#include "bsp_spi.h"


extern SPI_HandleTypeDef hspi5;


int8_t imu_spi_transmit(uint8_t *txbuf,uint8_t *rxbuf,uint16_t length)
{
	if( txbuf == NULL || rxbuf == NULL )
	{
		return -1;
	}
	return HAL_SPI_TransmitReceive(&hspi5,txbuf,rxbuf,length,100);
}


void imu_spi_cs(uint8_t state)
{
	if( state )
	{
		HAL_GPIO_WritePin(IMU_CS_GPIO_Port,IMU_CS_Pin,GPIO_PIN_SET);
	}
	else	
	{
		HAL_GPIO_WritePin(IMU_CS_GPIO_Port,IMU_CS_Pin,GPIO_PIN_RESET);
	}
}

